package exception;

import java.util.Scanner;

public class MYException {

    private static final String Username="张三";
    private static final int Password=12345;

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入用户名： ");
        String username=scanner.nextLine();
        System.out.println("请输入密码： ");
        int password=scanner.nextInt();
        if(!Username.equals(username)){
            throw new UserNameExcepton("用户名输入错误！！！");
        }
        if (Password!=password){
            throw new PasswordException("密码输入错误！！！");
        }
    }
}
    class UserNameExcepton extends RuntimeException{
    public UserNameExcepton(String message){
        super(message);
    }
}
    class PasswordException extends RuntimeException{
    public PasswordException(String message){
        super(message);
    }
}
